from xlrd import open_workbook

get_url = r'E:\桌面\wc_data\南方_20230410.xlsx'

# workbook = open_workbook(get_url)
#
# table = workbook.sheets()[0]
# print(workbook.sheet_names())
#
# print(workbook.sheet_by_name(sheet_name='588080'))
# listNames = ['证券代码', '证券名称', '实际数量', '清单股数', '替代标志']
#
#
# def get_data(dir_case, sheetnum):
#     data = open_workbook(dir_case)
#     table = data.sheets()[sheetnum]
#     nor = table.nrows
#     nol = table.ncols
#     dict = []
#     for i in range(0 if '代码' not in table.cell_value(0, 0) else 1, nor):
#         data = {}
#         for j in range(nol):
#             if '代码' not in table.cell_value(0, 0) and len(listNames) > j:
#                 title = listNames[j]
#             elif '代码' in table.cell_value(0, 0):
#                 title = table.cell_value(0, j)
#             else:
#                 title = ''
#             value = table.cell_value(i, j)
#             data[title] = value
#         dict.append(data)
#     return dict
#
#
# if __name__ == '__main__':
#     for k in get_data(get_url, 0):
#         print(k)
